package com.leiduoduo.oms.controller;

import com.leiduoduo.oms.annotation.PassToken;
import com.leiduoduo.oms.pojo.DishType;
import com.leiduoduo.oms.service.DishService;
import com.leiduoduo.oms.service.DishTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
public class DishTypeController {
    @Autowired
    DishTypeService dishTypeService;

    @PostMapping("/addDishType")
    @PassToken
    public boolean addDishType(DishType dishType){
        return dishTypeService.addDishType(dishType);
    }
    @PostMapping("/delDishType")
    @PassToken
    public boolean delDishType(DishType dishType){
        return dishTypeService.delDishType(dishType);
    }
    @PostMapping("/upDishType")
    @PassToken
    public boolean upDishType(DishType dishType){
        return dishTypeService.upDishType(dishType);
    }
    @GetMapping("/getDishTypeById/{id}")
    @PassToken
    public DishType getDishTypeById(@PathVariable("id") int id){
        return dishTypeService.getDishTypeById(id);
    }
    @GetMapping("/addDishTypeList")
    @PassToken
    public List<DishType> addDishTypeList(){
        return dishTypeService.getDishTypeList();
    }
}
